package com.webflux.sample.webfluxapp.remote;

import com.webflux.sample.webfluxapp.dto.MessageDTO;
import java.util.List;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import reactivefeign.spring.config.ReactiveFeignClient;
import reactor.core.publisher.Mono;

@ReactiveFeignClient(
    name = "web-message-feign",
    url = "http://localhost:8080"
)
public interface MessageFeign {

  @GetMapping("/info/test")
  Mono<String> testInfo(@RequestParam("name") String name);

  @GetMapping("/info/{id}")
  Mono<MessageDTO> getById(@PathVariable("id") Long id);

  @GetMapping("/info/list-all")
  Mono<List<MessageDTO>> listAll();

  @PostMapping("/info/save")
  Mono<MessageDTO> save(@RequestBody MessageDTO message);
}
